/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package org.workforce.common.tags;

import javax.servlet.jsp.JspException;
import javax.servlet.jsp.JspWriter;
import javax.servlet.jsp.tagext.TagSupport;

/**
 *
 * @author neo
 */
public class FieldSetTag extends TagSupport {

    private String label;
    private String style;
    private String sClass;
    private String align;
    private String border;
    private String width;
    private String colsStyle;
    private String colsClass;
    @Override
    public int doStartTag() throws JspException {
        JspWriter out = pageContext.getOut();
        StringBuilder s = new StringBuilder();
        s.append("<fieldset>\n");
        if( label != null) {
        s.append("<legand>").append(label).append("</legand>\n");
        }
        s.append("<table");
        if( width != null ) {
            s.append(" width=\"").append(width).append("\"");
        }
        if(border != null) {
            s.append(" border=\"").append(border).append("\"");
        }
        if(align != null) {
            s.append(" align=\"").append(align).append("\"");
        }
        s.append(">\n");
        s.append("<tr><td colspan=\"4\">&nbsp;</td></tr>");
        try {
            out.print(s.toString());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return EVAL_BODY_INCLUDE;
    }

    @Override
    public int doEndTag() throws JspException {
        JspWriter out = pageContext.getOut();
        StringBuffer s = new StringBuffer();
        s.append("</table></fieldset>\n");
        try {
            out.print(s.toString());
        } catch (Exception ex) {
            ex.printStackTrace();
        }
        return super.doEndTag();
    }

    public void setLabel(String label) {
        this.label = label;
    }

    public void setClass(String sClass) {
        this.sClass = sClass;
    }

    public void setStyle(String style) {
        this.style = style;
    }

    public String getsClass() {
        return sClass;
    }

    public void setsClass(String sClass) {
        this.sClass = sClass;
    }

    public String getWidth() {
        return width;
    }

    public void setWidth(String width) {
        this.width = width;
    }

    public void setBorder(String border) {
        this.border = border;
    }

    public void setAlign(String align) {
        this.align = align;
    }

    
}
